/*
* Conditions Of Use
*
* This software was developed by employees of the Sigmatrix(Beijing) Corporation.
* This software is provided by sigmatrix as a service and is expressly
* provided "AS IS."  Sigmatrix MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
* AND DATA ACCURACY.  Sigmatrix does not warrant or make any representations
* regarding the use of the software or the results thereof, including but
* not limited to the correctness, accuracy, reliability or usefulness of
* the software.
*
* Permission to use this software is contingent upon your acceptance
* of the terms of this agreement.
*
*/
package com.sigmatrix.h5.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.microsoft.windowsazure.exception.ServiceException;
import com.sigmatrix.h5.entity.DisDealer;
import com.sigmatrix.h5.entity.DisRebateScanCode;
import com.sigmatrix.h5.web.args.DealerInventoryPageParam;
import com.sigmatrix.h5.web.mode.DealerInventory;
import com.sigmatrix.h5.web.mode.DealerInventoryData;
import com.sigmatrix.h5.web.mode.DealerInventoryDayCount;
import com.sigmatrix.sc.jdbc.common.lang.Page;
import com.sigmatrix.sc.jdbc.common.service.Service;

/**
 *@ClassName: DisRebateScanCodeService
 *@Description: 
 *@author MH
 *@date 2017年8月14日 下午8:01:33
 */
public interface DisRebateScanCodeService extends Service<DisRebateScanCode,Integer>{
	
	/**
	 * 查询经销商反填的次数
	 *@Title: selectCountByDealerIdAndActivityId
	 *@Description: 
	 *@return Integer
	 *@author MH
	 *@date 2017年8月16日 下午9:27:26
	 *@param dealerId
	 *@param activityId
	 *@return
	 *@throws ServiceException
	 */
	@Deprecated
	Integer selectCountByDealerAcctsIdAndActivityId(String acct,Integer activityId);
	/**
	 * 查询经销商反填的次数
	 *@Title: selectCountByDealerIdAndActivityId
	 *@Description: 
	 *@return Integer
	 *@author MH
	 *@date 2017年8月30日 上午11:40:11
	 *@param dealerId
	 *@param activityId
	 *@return
	 *@throws ServiceException
	 */
	Integer selectCountByDealerIdAndActivityId(Integer dealerId,Integer activityId);
	
	/**
	 * 
	 *@Title: determainDealerId
	 *@Description: 层级扫码时判断经销商
	 *@return DisRebateScanCode
	 *@author MH
	 *@date 2017年12月5日 上午11:08:36
	 *@param qrCode
	 *@return
	 */
	DisRebateScanCode findLastScanDealer(String qrCode);
	
	/**
	 * 
	 *@Title: determineRebateDealers
	 *@Description: 找出需要返利的各级经销商（层级返利）
	 *@return List<DistributionDealers>
	 *@author MH
	 *@date 2017年12月6日 上午9:15:26
	 *@param lastScanDealerId
	 *@return
	 */
	List<DisDealer> determineRebateDealers(List<DisRebateScanCode> scanHistory,Map<Integer, String> dealers);
	
	/**
	 * 
	 *@Title: findScanHistory
	 *@Description: 查询扫码记录按照时间倒序排序
	 *@return List<DisRebateScanCode>
	 *@author MH
	 *@date 2017年12月6日 上午9:41:53
	 *@param qrCode
	 *@return
	 */
	List<DisRebateScanCode> findScanHistory(String qrCode);
	
	List<DisRebateScanCode> findScanHistory2_6(String qrCode,String qrCode2);
	
	/**
	 * 
	 *@Title: findScanHistory
	 *@Description: 
	 *@return List<DisRebateScanCode>
	 *@author MH
	 *@date 2017年12月9日 上午11:52:48
	 *@param urlDomin
	 *@param seqNum
	 *@return
	 */
	List<DisRebateScanCode> findScanHistory(String urlDomin,String seqNum);
	/**
	 * 
	 * @param po
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Page<DealerInventoryData> findInventoryPage(DealerInventoryPageParam vo);
	
	/**
	 * 
	 *@Title: findFirstScanOfOpenIdByActivity
	 *@Description:查询openId在某个活动中的第一次扫码记录
	 *@return DisRebateScanCode
	 *@author MH
	 *@date 2018年1月29日 下午3:58:20
	 *@param openId
	 *@param activityId
	 *@return
	 */
	DisRebateScanCode findFirstScanOfOpenIdByActivity(String openId,Integer activityId);
	
	/**
	 * 
	 *@Title: countByOpenIdInHoure
	 *@Description:
	 *@return Integer
	 *@author MH
	 *@date 2018年1月29日 下午4:06:56
	 *@param openId
	 *@param firstScanTime
	 *@return
	 */
	Integer countByOpenIdInHoure(String openId,Integer activityId,Date firstScanTime,int period);
	/**
	 * 通过openId查询
	 *@Title: findByOpenId
	 *@return List<DisRebateScanCode>
	 *@author MH
	 *@date 2018年3月27日 下午6:51:16
	 *@param openId
	 *@return
	 */
	List<DisRebateScanCode> findByOpenId(String openId);
	List<DealerInventoryDayCount> findDayCount(DealerInventoryPageParam vo);
	DealerInventory findDealerInventory(DealerInventoryPageParam vo);
}
